package errors

import "net/http"

var (
	DefaultError = Error{
		Code:       999,
		Message:    "unknown_error",
		Detail:     "服务器维护中",
		StatusCode: http.StatusBadRequest,
	}

	TokenCreateFailed = Error{
		Code:       1000,
		Message:    "token_create_failed",
		Detail:     "token生成失败",
		StatusCode: http.StatusServiceUnavailable,
	}

	TokenParseFailed = Error{
		Code:       1001,
		Message:    "token_parse_failed",
		Detail:     "token解析失败",
		StatusCode: http.StatusBadRequest,
	}

	TokenInvalidError = Error{
		Code:       1002,
		Message:    "token_invalid_error",
		Detail:     "token不合法",
		StatusCode: http.StatusBadRequest,
	}

	TokenIsRequired = Error{
		Code:       1003,
		Message:    "token_is_required",
		Detail:     "token为空",
		StatusCode: http.StatusBadRequest,
	}

	ParamMissingError = Error{
		Code:       1010,
		Message:    "request_param_missing",
		Detail:     "请求参数丢失",
		StatusCode: http.StatusBadRequest,
	}

	ParamIsRequired = Error{
		Code:       1011,
		Message:    "param_is_required",
		Detail:     "参数为空",
		StatusCode: http.StatusBadRequest,
	}

	ParamIsInvalid = Error{
		Code:       1012,
		Message:    "param_is_invalid",
		Detail:     "参数非法",
		StatusCode: http.StatusBadRequest,
	}

	UserInvalidError = Error{
		Code:       1030,
		Message:    "user_invalid_error",
		Detail:     "用户不存在",
		StatusCode: http.StatusBadRequest,
	}

	UserCreateError = Error{
		Code:       1031,
		Message:    "user_create_error",
		Detail:     "用户注册失败",
		StatusCode: http.StatusBadRequest,
	}

	UserAlreadyExistError = Error{
		Code:       1032,
		Message:    "user_alreay_exist",
		Detail:     "用户已经存在",
		StatusCode: http.StatusBadRequest,
	}

	FriendAddError = Error{
		Code:       1050,
		Message:    "friend_add_error",
		Detail:     "添加好友失败",
		StatusCode: http.StatusServiceUnavailable,
	}

	FriendInvalidError = Error{
		Code:       1051,
		Message:    "friend_invalid_error",
		Detail:     "好友不存在",
		StatusCode: http.StatusBadRequest,
	}

	ChatAddError = Error{
		Code:       1100,
		Message:    "chat_add_error",
		Detail:     "新建聊天失败",
		StatusCode: http.StatusServiceUnavailable,
	}

	ChatNotExist = Error{
		Code:       1101,
		Message:    "chat_not_exist_error",
		Detail:     "聊天不存在",
		StatusCode: http.StatusBadRequest,
	}

	ChatForbiddenError = Error{
		Code:       1102,
		Message:    "chat_change_forbidden",
		Detail:     "没有变更权限",
		StatusCode: http.StatusBadRequest,
	}

	OpcodeUnknown = Error{
		Code:    1300,
		Message: "opcode_unknown",
		Detail:  "未知操作码",
	}
)
